-
Notifications
You must be signed in to change notification settings - Fork 51
Reduce usage of shared_ptr in the core #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
…test Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
Signed-off-by: Laurynas Jagutis <[email protected]>
|
| static constexpr auto is_iterative = true; | ||
|
|
||
| IterativeCurrentPFSolver(YBus<sym> const& y_bus, std::shared_ptr<MathModelTopology const> const& topo_ptr) | ||
| IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo_ptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is no longer a pointer
| IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo_ptr) | |
| IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo) |
| private: | ||
| // cache topology | ||
| std::shared_ptr<MathModelTopology const> math_topology_; | ||
| MathModelTopology const& math_topology_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
member types should not be const& as it prevents it from being copyable and movable. Instead, please use either a raw pointer const* or a std::reference_wrapper
| data_gain_(y_bus.nnz_lu()), | ||
| delta_x_rhs_(y_bus.size()), | ||
| x_(y_bus.size()), | ||
| sparse_solver_{y_bus.shared_indptr_lu(), y_bus.shared_indices_lu(), y_bus.shared_diag_lu()}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i even think we can remove shared_indptr_lu and shared_indices_lu and shared_diag_lu altogether
| auto const& row_indptr = row_indptr_; | ||
| auto const& col_indices = col_indices_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may want to use the member version in the rest of the code as well. the utility declaration auto const& was only to remove the need to specify pointer everywhere



Related to #994
So far using references, reference wrappers to replace shared_ptr.